<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>2016春夏订货会－意见收集系统</title>

<meta name="description" content="User login page" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- basic styles -->

<link
	href="${pageContext.request.contextPath}/resources/bt_v3/assets/css/bootstrap.min.css"
	rel="stylesheet" />
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/resources/bt_v3/assets/css/font-awesome.min.css" />

<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/bt_v3/assets/css/chosen.css" />
<!--[if IE 7]>
		  <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/bt_v3/assets/css/font-awesome-ie7.min.css" />
		<![endif]-->

<!-- page specific plugin styles -->

<!-- fonts -->

<link rel="stylesheet"
	href="${pageContext.request.contextPath}/resources/bt_v3/assets/css/ace-fonts.css" />

<!-- ace styles -->

<link rel="stylesheet"
	href="${pageContext.request.contextPath}/resources/bt_v3/assets/css/ace.min.css" />
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/resources/bt_v3/assets/css/ace-rtl.min.css" />

<!--[if lte IE 8]>
		  <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/bt_v3/assets/css/ace-ie.min.css" />
		<![endif]-->

<!-- inline styles related to this page -->

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

<!--[if lt IE 9]>
		<script src="${pageContext.request.contextPath}/resources/bt_v3/assets/js/html5shiv.js"></script>
		<script src="${pageContext.request.contextPath}/resources/bt_v3/assets/js/respond.min.js"></script>
		<![endif]-->
<style type="text/css">
.table td {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	vertical-align: middle;
	text-align: center;
}

.modal-dialog {
	z-index: 1050;
	width: 90%;
	padding: 10px;
	margin-right: auto;
	margin-left: auto
}
</style>
</head>

<!-- 模态框（Modal） -->
<div class="modal fade" id="voteModal" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">意见填写</h4>
			</div>
			<div class="modal-body">
			<form id="voteForm">
				<table class="table table-striped table-bordered">
					<tr>
						<td width="60">分公司<input type="hidden" name="docId" id="docId" value="" /> <input type="hidden" name="jimg" id="jimg" value="${param.imgId}" /></td>
						<td width="100">${sessionScope.userSession.sysUser.forWork }</td>
					</tr>
					<tr>
						<td width="60">店铺名称</td>
						<td width="100">
							<select id="jshopcode" class="chosen-select" name="jshopcode" data-placeholder="请选择!" multiple="multiple">
													<option value="">请选择</option>
												</select>
						</td>
					</tr>
					<tr>
						<td width="60">店铺橱窗数量</td>
						<td width="100"><input type="text" id="jnum" name="jnum" placeholder="请输入数量" class="col-xs-10 col-sm-10"></td>
					</tr>
					<tr>
						<td width="60">分公司对接人</td>
						<td width="100"><input type="text" id="jdjr" name="jdjr" placeholder="请填写对接人" class="col-xs-10 col-sm-10"></td>
					</tr>
					<tr>
						<td width="60">分公司对接人电话</td>
						<td width="100"><input type="text" id="jdjt" name="jdjt" placeholder="请填写对接人电话" class="col-xs-10 col-sm-10"></td>
					</tr>
				</table>
			</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭
				</button>
				<button type="button" class="btn btn-primary" id="btn_vote">提交</button>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal -->
</div>

<div class="container-fluid">
	<div class="row">
		<div class="col-xs-12">

<div id="fuelux-wizard" class="row-fluid" data-target="#step-container">
														<ul class="wizard-steps">
															<li data-target="#step1"  id="btn_1">
																<span class="step">1</span>
																<span class="title">2016春夏订货会-意见收集表（商品）</span>
															</li>

															<li data-target="#step2" id="btn_2" class="active">
																<span class="step">2</span>
																<span class="title">橱窗增订</span>
															</li>

															<li data-target="#step3" id="btn_3" >
																<span class="step">3</span>
																<span class="title">橱窗执行情况调查</span>
															</li>

															<li data-target="#step4">
																<span class="step">4</span>
																<span class="title">待开发，敬请期待</span>
															</li>
														</ul>
													</div>
													

                                        <div class=" gallery">
                                            <div class="row">
                                                <div class="col-sm-12">
                                                    <img alt="image" class="img-responsive carousel-inner  img-rounded" src="${param.imgId }.jpg">
                                                </div>
                                            </div>
                                        </div>
                               
                             										
			<table class="table table-striped table-bordered ">
				
					<tr >
						<td colspan="7">${sessionScope.userSession.sysUser.nickName }[${sessionScope.userSession.sysUser.company }]</td>
						</td>
					</tr>
				<tr>
					<td  style="text-align: left;" colspan="7">
						请填写以下信息
						<font style="color:red;">对于橱窗订购方式如有疑问，请联系：谢周杰：18965528978&nbsp;&nbsp;曾振展：18959998022</font>
					</td>
				</tr>
				<tbody id="show"></tbody>
				<tr>
					<td colspan="7">	
						<button type="button" id="btn_add" class="btn btn-info btn-app btn-sm">添加</button>&nbsp;&nbsp;&nbsp;&nbsp;
					</td>
				</tr>
			</table>
		</div>
	</div>
</div>

<!-- basic scripts -->

<!--[if !IE]> -->

<script type="text/javascript">
	window.jQuery
			|| document
					.write("<script src='${pageContext.request.contextPath}/resources/bt_v3/assets/js/jquery-2.0.3.min.js'>"
							+ "<"+"/script>");
</script>
	<script src="${pageContext.request.contextPath}/resources/bt_v3/assets/js/chosen.jquery.min.js"></script>
<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='${pageContext.request.contextPath}/resources/bt_v3/assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->

<script type="text/javascript">
	if ("ontouchend" in document)
		document
				.write("<script src='${pageContext.request.contextPath}/resources/bt_v3/assets/js/jquery.mobile.custom.min.js'>"
						+ "<"+"/script>");
</script>
<script
	src="${pageContext.request.contextPath}/resources/bt_v3/assets/js/bootstrap.min.js"></script>


<script type="text/javascript">
	
	//提交当前用户投票结果
	function fn_saveVote() {
		
		var data = new Object();
		data = $('#voteForm').serialize();

		$
				.ajax({
					url : "${pageContext.request.contextPath}/admin/joeoneVoteCc/saveShops.do",
					async : true,
					dataType : 'json',
					type : 'POST',
					data : data,
					success : function(data, textStatus) {
						if (data.result == "success") {
							alert("提交成功！");
							var req_address = "${pageContext.request.contextPath}/joeone/ipad/vote_cc_choose.jsp?imgId=${param.imgId}";
							window.location.href = req_address;
						} else {

							alert(data.message);
						}
					},
					error : function(jqXHR, textStatus, errorThrown) {
						var sessionstatus = jqXHR
								.getResponseHeader("sessionstatus");
						if (sessionstatus == "timeout") {
							alert("[timeout]您登陆已经超时，请重新登陆!");
							var req_address = "${pageContext.request.contextPath}/joeone/ipad/index_dhVote.jsp";
							window.location.href = req_address;
						} else {
							alert("网络连接失败，请重试!");
						}
					}

				});

	}
	function fn_cancel() {
		var req_address = "${pageContext.request.contextPath}/joeone/ipad/vote_demo5.jsp?jconf="+$("#jconf").val();
		window.location.href = req_address;
	}
	//获取启用的当前 配置
	function fn_getJconf() {
		var data = new Object();
		data['docStatus'] = "10";
		data['pageNo'] = "1";
		data['pageSize'] = "500";
		data['jcomcode'] = "${sessionScope.userSession.sysUser.name }";
		$
				.ajax({
					url : "${pageContext.request.contextPath}/admin/joeCom2shop/list.do",
					async : false,
					dataType : 'json',
					type : 'GET',
					data : data,
					success : function(data, textStatus) {
						$.each(data.data.listData, function(i, item) {
							$("#jshopcode").append(
									"<option value='"+item.jshopcode+"'>"
											+ item.jshop + "</option>");
						});
						
					},
					error : function(jqXHR, textStatus, errorThrown) {
						var sessionstatus = jqXHR
								.getResponseHeader("sessionstatus");
						if (sessionstatus == "timeout") {
							alert("[timeout]您登陆已经超时，请重新登陆!");
							var req_address = "${pageContext.request.contextPath}/joeone/ipad/index_dhVote.jsp";
							window.location.href = req_address;
						}
					}

				});

	}
	//获取当前用户投票结果
	function fn_getVote() {

		var data = new Object();
		data['jimg'] = "${param.imgId}";
		data['pageNo'] = "1";
		data['pageSize'] = "100";
		data['docCreator'] = "${sessionScope.userSession.sysUser.docId }";

		$
				.ajax({
					url : "${pageContext.request.contextPath}/admin/joeoneVoteCc/list.do",
					async : false,
					dataType : 'json',
					type : 'GET',
					data : data,
					success : function(rtn, textStatus) {
						if (rtn.result == "success") {
							var trStr = "";
							$.each(rtn.data.listData, function(i, item) {

								trStr += "<tr>";
								trStr += "	<td >"+(i+1)+"</td>";
								trStr += "	<td >分公司:${sessionScope.userSession.sysUser.forWork }</td>";
								trStr += "	<td >店铺名称:<font style='color:red'>"+item.jshop+"</font></td>";
								trStr += "	<td >店铺橱窗数量:<font style='color:red'>"+item.jnum+"</font></td>";
								trStr += "	<td >分公司对接人:"+item.jdjr+"</td>";
								trStr += "	<td >分公司对接人电话:"+item.jdjt+"</td>";
								trStr += "	<td ><button type='button' id='btn_del"+item.docId+"' onclick='fn_del(this);'  data-id='"+item.docId+"' class='btn btn-success btn-app btn-sm'>删除</button></td>";
								trStr += "</tr>";
								
							});
							$("#show").html(trStr);
						} else {

							//alert(rtn.message);
						}
					},
					error : function(jqXHR, textStatus, errorThrown) {
						var sessionstatus = jqXHR
								.getResponseHeader("sessionstatus");
						if (sessionstatus == "timeout") {
							alert("[timeout]您登陆已经超时，请重新登陆!");
							var req_address = "${pageContext.request.contextPath}/joeone/ipad/index_dhVote.jsp";
							window.location.href = req_address;
						} else {
							alert("网络连接失败，请重试!");
						}
					}

				});
	}
	function fn_del(obj) {

		var data = new Object();
		data['docId'] = $(obj).data("id");
		alert(data['docId']);

		$
				.ajax({
					url : "${pageContext.request.contextPath}/admin/joeoneVoteCc/deleteX.do",
					async : false,
					dataType : 'json',
					type : 'POST',
					data : data,
					success : function(rtn, textStatus) {
						if (rtn.result == "success") {

							var req_address = "${pageContext.request.contextPath}/joeone/ipad/vote_cc_choose.jsp?imgId=${param.imgId}";
							window.location.href = req_address;
						} else {

							//alert(rtn.message);
						}
					},
					error : function(jqXHR, textStatus, errorThrown) {
						var sessionstatus = jqXHR
								.getResponseHeader("sessionstatus");
						if (sessionstatus == "timeout") {
							alert("[timeout]您登陆已经超时，请重新登陆!");
							var req_address = "${pageContext.request.contextPath}/joeone/ipad/index_dhVote.jsp";
							window.location.href = req_address;
						} else {
							alert("网络连接失败，请重试!");
						}
					}

				});
	}
	function fn_changeSur(){
		var click_btn = $(this).attr("id");
		if(click_btn == "btn_1"){
			window.location.href = "${pageContext.request.contextPath}/joeone/ipad/vote_demo5.jsp";
		}else if(click_btn == "btn_2"){
			window.location.href = "${pageContext.request.contextPath}/joeone/ipad/vote_cc.jsp";
		}else if(click_btn == "btn_3"){
			window.location.href = "${pageContext.request.contextPath}/joeone/ipad/vote_cc_qu.jsp";
		}
	}
	function fn_add(){
		$("#voteModal").modal("show");
	}
	$(document).ready(function() {
		fn_getJconf();
		fn_getVote();
		$("#btn_add").bind("click", fn_add);
		$("#btn_vote").bind("click", fn_saveVote);
		$("#btn_1").bind("click", fn_changeSur);
		$("#btn_2").bind("click", fn_changeSur);
		$("#btn_3").bind("click", fn_changeSur);
		$(".chosen-select").chosen({
			no_results_text: "没有找到匹配项!", 
			placeholder_text : "请输入您要查找的选项!", 
			search_contains: true,
			disable_search_threshold: 2,
			width:"95%"
	    });
	});
</script>

</body>
</html>